package models;

public class TourneyBean {
	private int ID;
	private String name;
	private int maxPlayers;
	private String game;
	private String start;
	private int registeredPlayers;
	private int signedInPlayers;
	private String status;
	private boolean gridAvailable;
	
	public TourneyBean(int ID, String name, String start, int maxPlayers, String game) {
		this.ID = ID;
		this.name = name;
		this.maxPlayers = maxPlayers;
		this.game = game;
		this.start = start;
		this.gridAvailable = false;
	}
	
	public TourneyBean(int ID, String name, String start, int maxPlayers, String game, String status) {
		this.ID = ID;
		this.name = name;
		this.maxPlayers = maxPlayers;
		this.game = game;
		this.start = start;
		this.status = status;
		this.gridAvailable = false;
	}
	
	public TourneyBean(int ID, String name, String start, int maxPlayers, String game, int regPlayers, String status) {
		this.ID = ID;
		this.name = name;
		this.maxPlayers = maxPlayers;
		this.registeredPlayers = regPlayers;
		this.game = game;
		this.start = start;
		this.status = status;
		this.gridAvailable = false;
	}
	
	public TourneyBean(int ID, String name, String start, int maxPlayers, String game, int regPlayers, int signedPlayers, String status) {
		this.ID = ID;
		this.name = name;
		this.maxPlayers = maxPlayers;
		this.game = game;
		this.start = start;
		this.registeredPlayers = regPlayers;
		this.signedInPlayers = signedPlayers;
		this.status = status;
		this.gridAvailable = false;
	}
	
	public boolean equals(Object o) {
		if(o instanceof TourneyBean) {
			TourneyBean t = (TourneyBean) o;
			if(t.getID() == this.ID)
				return true;
		}
		return false;
	}
	
	public int getID() {
		return ID;
	}

	public void setID(int iD) {
		ID = iD;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getMaxPlayers() {
		return maxPlayers;
	}

	public void setMaxPlayers(int maxPlayers) {
		this.maxPlayers = maxPlayers;
	}

	public String getGame() {
		return game;
	}

	public void setGame(String game) {
		this.game = game;
	}

	public String getStart() {
		return start;
	}

	public void setStart(String start) {
		this.start = start;
	}

	public int getRegisteredPlayers() {
		return registeredPlayers;
	}

	public void setRegisteredPlayers(int registeredPlayers) {
		this.registeredPlayers = registeredPlayers;
	}

	public String getStatus() {
		return status.toUpperCase();
	}
	
	public String getStatusColor() {
		if(status.equals("running"))
			return "#FFCC00";
		else if(status.equals("signin") || status.equals("signup"))
			return "green";
		else
			return "red";
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public boolean isGridAvailable() {
		return gridAvailable;
	}

	public void setGridAvailable(boolean gridAvailable) {
		this.gridAvailable = gridAvailable;
	}

	public int getSignedInPlayers() {
		return signedInPlayers;
	}

	public void setSignedInPlayers(int signedInPlayers) {
		this.signedInPlayers = signedInPlayers;
	}
}
